Assignemnt #96 and 96th program

Code

///Name: Derrick Andreasen
///Period: 7
///Program name: 96th Program
///File name: Ninty6prog.java
///Date Finished:3/9/2016

import java.util.Scanner;

public class Ninty6prog
{
	public static void main( String[] args )
	{
		Scanner keyboard = new Scanner(System.in);

		System.out.println("Welcome to Mr. Davis's fantastic birth-o-meter!");
		System.out.println();
		System.out.println("All you have to do is enter your birth date, and it will");
		System.out.println("tell you the day of the week on which you were born.");
		System.out.println();
		System.out.println("Some automatic tests....");
		System.out.println("12 10 2003 => " + weekday(12,10,2003));
		System.out.println(" 2 13 1976 => " + weekday(2,13,1976));
		System.out.println(" 2 13 1977 => " + weekday(2,13,1977));
		System.out.println(" 7  2 1974 => " + weekday(7,2,1974));
		System.out.println(" 1 15 2003 => " + weekday(1,15,2003));
		System.out.println("10 13 2000 => " + weekday(10,13,2000));
		System.out.println();

		System.out.println("Now it's your turn!  What's your birthday?");
		System.out.print("Birth date (mm dd yyyy): ");
		int mm = keyboard.nextInt();
		int dd = keyboard.nextInt();
		int yyyy = keyboard.nextInt();

		System.out.println("You were born on " + weekday(mm,dd,yyyy) + "!");
	}


	public static String weekday( int mm, int dd, int yyyy )
	{
		int yy, total;
		String date = "";

   yy = yyyy - 1900;
   
   total = (yy / 4) + yy + dd + monthOffset(mm);
   
   if(isLeap(yyyy) && (0 < mm) && (mm <= 2))
      total = total%7;
   int wd = total%7;
   date = weekdayName(wd) + ", " + monthName(mm)+ " " + dd + ", " + yyyy;
		
		return date;
	}


	
		
	public static String monthName( int mm )
	{
		String m;
      
      if (mm == 1)
         m=("January");
      else if (mm == 2)
         m=("Feburary");
      else if (mm == 3)
         m=("March");
      else if (mm == 4)
         m=("April");
      else if (mm == 5)
         m=("May");
      else if (mm == 6)
         m=("June");
      else if (mm == 7)
         m=("July");
      else if (mm == 8)
         m=("August");
      else if (mm == 9)
         m=("September");
      else if (mm == 10)
         m=("October");
      else if (mm == 11)
         m=("November");
      else if (mm == 12)
         m=("December");
      else
         m=("ERROR");
          
      return m;
      }
      
   public static String weekdayName(int wd)
   {
      String d;
      
      if(wd == 1)
         d = ("Sunday");
      else if(wd == 2)
         d = ("Monday");
      else if(wd == 3)
         d = ("Tuesday");
      else if(wd == 4)
         d = ("Wednesday");
      else if(wd == 5)
         d = ("Thursday");
      else if(wd == 6)
         d = ("Friday");
      else if(wd == 7)
         d = ("Saturday");
      else
         d = ("ERROR");
          
      return d;
      }
   public static int monthOffset (int mm)
   {
      int offset;
      
      if(mm == 1)
         offset = 1;
     else if(mm == 2)
         offset = 4;
     else if(mm == 3)
         offset = 4;
     else if(mm == 4)
         offset = 0;
     else if(mm == 5)
         offset = 2;
     else if(mm == 6)
         offset = 5;
     else if(mm == 7)
         offset = 0;
     else if(mm == 8)
         offset = 3;
     else if(mm == 9)
         offset = 6;
     else if(mm == 10)
         offset = 1;
     else if(mm == 11)
         offset = 4;
     else if(mm == 12)
         offset = 6;
     else
         offset = -1;
         
     return offset;
   }
   
   
   public static boolean isLeap(int year)
   {
		boolean result;

		if ( year%400 == 0 )
			result = true;
		else if ( year%100 == 0 )
			result = false;
		else if ( year%4 == 0 )
			result = true;
		else
			result = false;
		
		return result;
	}
}

    

Picture of the output

Assignment 96